Skip to content

Add power-source selection for hybrid inverter controls#382

Merged
tiyash-basu-frequenz merged 1 commit intofrequenz-floss:v0.x.xfrom
tiyash-basu-frequenz:258_hybrid_inverter_controls
Mar 4, 2026
Merged

Add power-source selection for hybrid inverter controls#382
tiyash-basu-frequenz merged 1 commit intofrequenz-floss:v0.x.xfrom
tiyash-basu-frequenz:258_hybrid_inverter_controls

Conversation

@tiyash-basu-frequenz
Copy link
Contributor

This commit adds the ability to specify a preferred power source when issuing discharge commands to hybrid inverters, which typically have both PV and battery inputs added to them, and can use either of those inputs as the power source.

Both the v1alpha18 and v1alpha19 APIs are updated in this PR. Since v0.19.0 is not yet released, I have renumbered the fields in the SetElectricalComponentPowerRequest message of the v1alpha19 package.

closes #258

@tiyash-basu-frequenz tiyash-basu-frequenz self-assigned this Mar 3, 2026
@tiyash-basu-frequenz tiyash-basu-frequenz requested a review from a team as a code owner March 3, 2026 15:36
@github-actions github-actions bot added part:docs Affects the documentation part:protobuf Affects the protocol buffer definition files labels Mar 3, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a way for clients to express a preferred DC power source when setting discharge active-power setpoints for hybrid inverters, updating both the v1alpha18 and v1alpha19 preview APIs and documenting the additions in release notes.

Changes:

  • Introduce PowerSource enum to express PV/battery preferred/only behaviors for hybrid-inverter discharge commands.
  • Add power_source to SetElectricalComponentPowerRequest (and renumber fields in v1alpha19 as noted in the PR description).
  • Update RELEASE_NOTES.md to reflect v1alpha18 symbol additions and adjust upgrade notes wording.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
proto/frequenz/api/microgrid/v1alpha19/microgrid.proto Adds PowerSource and power_source field; renumbers request fields to accommodate the new field.
proto/frequenz/api/microgrid/v1alpha18/microgrid.proto Adds PowerSource and power_source field as a backward-compatible addition.
RELEASE_NOTES.md Documents the v1alpha18 additions and adjusts upgrade guidance text.
Comments suppressed due to low confidence (6)

proto/frequenz/api/microgrid/v1alpha19/microgrid.proto:605

  • The comment says “discharge power setpoint”, but the rest of this file consistently uses “set-point” (hyphenated). For consistency, consider changing this to “set-point”.
  // The preferred power source for the electrical component when setting a
  // discharge power setpoint. This is relevant for hybrid inverters which have
  // both PV and battery inputs added to them, and can use either of those

proto/frequenz/api/microgrid/v1alpha18/microgrid.proto:616

  • power_source is a proto3 enum field, so callers can’t really “not provide” it in a distinguishable way (omitting it on the wire yields the default POWER_SOURCE_UNSPECIFIED). Consider updating the wording to reflect that POWER_SOURCE_UNSPECIFIED/omitted means PV-preferred, or make the field optional if presence needs to be detected.
  // If the above criteria are met, and this field is not provided, then the API
  // service will default to using `POWER_SOURCE_PV_PREFERRED` as the power
  // source.
  //

proto/frequenz/api/microgrid/v1alpha18/microgrid.proto:605

  • The comment says “discharge power setpoint”, but the rest of this file consistently uses “set-point” (hyphenated). For consistency, consider changing this to “set-point”.
  // The preferred power source for the electrical component when setting a
  // discharge power setpoint. This is relevant for hybrid inverters which have
  // both PV and battery inputs added to them, and can use either of those

proto/frequenz/api/microgrid/v1alpha18/microgrid.proto:620

  • In v1alpha18, power_source is field number 5 but it appears before fields 3 (power) and 4 (request_lifetime) in the message definition. Reordering the fields in the .proto to match numeric order would make the schema easier to read and less error-prone to maintain.
  PowerSource power_source = 5;

RELEASE_NOTES.md:18

  • The release notes summary currently states that all new features are available exclusively in v1alpha19, but this PR also adds new API surface to the stable v1alpha18 package. Please update the earlier summary wording to avoid implying v1alpha18 is unchanged in this release.
## Stable `v1alpha18` Preview API

The `v1alpha18` API is also stable and has the following symbol additions:

proto/frequenz/api/microgrid/v1alpha19/microgrid.proto:616

  • power_source is a proto3 enum field, so callers can’t really “not provide” it in a distinguishable way (omitting it on the wire yields the default POWER_SOURCE_UNSPECIFIED). Consider updating the wording to reflect that POWER_SOURCE_UNSPECIFIED/omitted means PV-preferred, or make the field optional if presence needs to be detected.
  // If the above criteria are met, and this field is not provided, then the API
  // service will default to using `POWER_SOURCE_PV_PREFERRED` as the power
  // source.
  //

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@florian-wagner-frequenz florian-wagner-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, but l don't think we should be doing a breaking update to the Microgrid API without increasing to v1alpha20

@llucax
Copy link
Contributor

llucax commented Mar 4, 2026

LGTM in general, but l don't think we should be doing a breaking update to the Microgrid API without increasing to v1alpha20

v1alpha19 is unreleased

@tiyash-basu-frequenz
Copy link
Contributor Author

but l don't think we should be doing a breaking update to the Microgrid API without increasing to v1alpha20

Also responded here.

llucax
llucax previously approved these changes Mar 4, 2026
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides my small OC observation, LGTM.

This commit adds the ability to specify a preferred power source when
issuing discharge commands to hybrid inverters, which typically have
both PV and battery inputs added to them, and can use either of those
inputs as the power source.

Signed-off-by: Tiyash Basu <tiyash.basu@frequenz.com>
Copy link

@florian-wagner-frequenz florian-wagner-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the context

@tiyash-basu-frequenz tiyash-basu-frequenz added this pull request to the merge queue Mar 4, 2026
Merged via the queue into frequenz-floss:v0.x.x with commit 11fcb61 Mar 4, 2026
7 checks passed
@tiyash-basu-frequenz tiyash-basu-frequenz deleted the 258_hybrid_inverter_controls branch March 4, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:protobuf Affects the protocol buffer definition files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Specifying DC Energy Source for Hybrid Inverters

4 participants